<?php
require_once('../phplib/include.inc.php');

class Home_Sidebar extends PageBase{
		public function Ini(){
		$this->GetActivity();
		$this->GetNews();
		$this->GetContactInfo();
	}
	public function GetActivity(){
		$db = getDb();
		$re = $db->fetch("SELECT b.cat_name,a.a_id,a.a_title,a.a_time,a.a_visit FROM article AS a LEFT JOIN category AS b ON a.c_id=b.c_id WHERE a.a_del=0 AND b.cat_name='公司动态' ORDER BY a.a_id DESC");
		$this->assign("activity",$re);
	}
	public function GetNews(){
		$db = getDb();
		$re = $db->fetch("SELECT b.cat_name,a.a_id,a.a_title,a.a_time,a.a_visit FROM article AS a LEFT JOIN category AS b ON a.c_id=b.c_id WHERE a.a_del=0 AND b.cat_name='行业新闻' ORDER BY a.a_id DESC");
		$this->assign("news",$re);
	}
	public function GetContactInfo(){
		$db = getDb();
		$re = $db->fetchOne("SELECT * FROM subhome WHERE s_name='联系信息'");
		$this->assign("contactinfo",unserialize($re['s_content']));
	}
}
$a = new Home_Sidebar("file:".dirname(__FILE__)."/../home/sidebar.tpl.html");
$a->display();
?>